<template>
  <div>
     <h1>辅助函数法 使用分模块</h1>
     <h1>分模块的state:{{cartnum}}</h1>
     <!-- this.$store.commit("分模块/方法",参数) -->
    <button @click="changeCart(188)">触发分模块mutations  </button>
    <button @click="actNum('1999')">触发分模块的actions</button>
  </div>
</template>
<script>
import {mapState,mapMutations,mapActions} from 'vuex'

export default {
    computed:{
      // 将分模块的state注入进来
      //  ...mapState("分模块名",["cartnum"])
      ...mapState("cartStore",["cartnum","age"])
    },
    methods:{
      // ...mapMutations("分模块名",["changeCart"])
        ...mapMutations("cartStore",["changeCart"]),
      // ...mapActions("分模块名",["actNum"])
      ...mapActions("cartStore",["actNum"])
    }
}
</script>